<?php
namespace ManagerX\Controller;
use Think\Controller;
class PayloadController extends Controller {
    public function index(){
    }

    public function payload_list(){
        if(session('?user') && session('user.role') == 1){
            $this->display('payload_list');
        }else{
            $this->error('未登录或无权限。', 'User/login', 3);
        }
    }

    public function payload_edit(){
        if(session('?user') && session('user.role') == 1){
            $payload = M('payload')->where(array('id'=>I('get.id')))->find();

            $this->assign('payload', $payload);
            $this->display('payload_edit');
        }else{
            $this->error('未登录或无权限。', 'User/login', 3);
        }
    }

    public function payload_add(){
        if(session('?user') && session('user.role') == 1){
            $this->display('payload_add');
        }else{
            $this->error('未登录或无权限。', 'User/login', 3);
        }
    }

    public function template_list(){
        if(session('?user') && session('user.role') == 1){
            $this->display('template_list');
        }else{
            $this->error('未登录或无权限。', 'User/login', 3);
        }
    }

    public function template_edit(){
        if(session('?user') && session('user.role') == 1){
            $template = M('template')->where(array('id'=>I('get.id')))->find();

            $this->assign('template', $template);
            $this->display('template_edit');
        }else{
            $this->error('未登录或无权限。', 'User/login', 3);
        }
    }

    public function template_add(){
        if(session('?user') && session('user.role') == 1){
            $this->display('template_add');
        }else{
            $this->error('未登录或无权限。', 'User/login', 3);
        }
    }
}